﻿#ifndef ALGWORKER_H
#define ALGWORKER_H
#include "Common/common.h"
#include <QObject>
#include "vector"


class AlgWorker : public QObject
{
    Q_OBJECT
public:
    explicit AlgWorker(QObject *parent = nullptr);
    ~AlgWorker();
    int Direction = 0;
    int result1 = 0;
    int result2 = 0;

    int m_nNGorOK[100];
    int m_nResult = 0;

    int m_nType = 0;   //0 正方形  1长方形  2梯形

    int m_nModel = 0; // 0 自动模式 1 手动模式 不计算数据
    HalconCpp::HTuple ModelID;
    // 存图
    SW_SaveImg m_swSaveImg;


    // 算法
    Defect m_defect;


    Judge_Direction m_judgeDirection;
    Measure_Rect m_measureRect;
    Measure_Trapezoid m_measureTrapezoid;


    HTuple Len;
    HTuple Angle;
    HObject OutImg;


    SW_Alg m_swAlg;

    int m_nAlgDefect = 0;
    int m_nAlgRect = 0;

    int CCD_Alg(HalconCpp::HObject img);

signals:
    void sigCameraResult(int m_nResult);


    void sigSaveImgStart(CameraData m_cImageInfo);
public slots :
    void Initialize();
    void start(CameraData m_cImageInfo);
private:
    void show(HalconCpp::HObject img, HalconCpp::HTuple hv_WindowHandle, int index);
};

#endif // ALGWORKER_H
